package com.taxi.comm.business;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class SpringContext {

	private static final Logger log = LoggerFactory.getLogger(SpringContext.class);
	
	private static ApplicationContext ac;

	public static void init() {
		log.info("Start to initialize the spring context.");
		ac = new ClassPathXmlApplicationContext("applicationContext-*.xml");
		log.info("Finished.");
	}

	public static Object get(String actionName) {
		return ac.getBean(actionName);
	}
	
	public static Object get(Class type) {
		return ac.getBean(type);
	}
	
}
